<?php
/**
 * 模型组复制整体妆容使用
 *
 * @author Zeon <scplay@gmail.com>
 * @date 2018/9/12 16:10
 * @copyright PanxSoft Inc.
 */

namespace App\Http\Controllers\Service\Util;


use App\Http\Controllers\ApiController;
use App\Http\Requests\Service\Util\PusherMessageRequest;
use App\Services\Pusher\PanxPusher;

class PusherController extends ApiController
{
    /**
     * 使用 pusher 发送消息
     *
     * @param PusherMessageRequest $request
     * @param PanxPusher $pusher
     *
     * @return array|\Illuminate\Http\Response
     * @throws \Pusher\PusherException
     */
    public function message(PusherMessageRequest $request, PanxPusher $pusher)
    {
        $sent = $pusher->sendMessage($request->channel, $request->event, $request->message);

        return $this->response(compact('sent'));
    }
}